#ifndef SDLGRAPHICS_H
#define SDLGRAPHICS_H

#include "SDL/SDL.h"
#include "SDL/SDL_TTF.h"
#include "SDL/SDL_gfxPrimitives.h"
#include "SDL/SDL_gfxPrimitives_font.h"
#include "SDL/SDL_framerate.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_rotozoom.h"
#include "gamemath.h"
#include "global.h"
#include "collisionHandle.h"

extern SDL_Surface* i_tilegreen;
extern SDL_Surface* i_tilebrown;
extern SDL_Surface* i_tilered;
extern SDL_Surface* i_dirttileset[9];
extern SDL_Surface* i_tilezombie;
extern SDL_Surface* i_boxalpha;
extern SDL_Surface* i_toweralpha;
extern collisionHandle* g_col;
extern SDL_Surface* i_items[9];
class SDLGraphics
{
// Methods
public:
	int player_origin_x, player_origin_y;
	SDL_Surface* m_screen;
	SDL_Surface* ShadowLayer;
   SDLGraphics(int windowWidth, int windowHeight, const char* windowTitle, int bgR, int bgG, int bgB);
   ~SDLGraphics();
   // Each call to loadBitmap() must have a corresponding call to closeBitmap().
   SDL_Surface* loadImage(const char* ImageFileName, int transparentRed, int transparentGreen, int transparentBlue);
   void closeBitmap(SDL_Surface* bitmap);
   //image handling methods:
   void loadSprites();
   SDL_Surface* createMap(char map[][255],int colsize,int rowsize);
   int get_origin_x();//get the players origin based on the current map. ONLY CALL AFTER createMap()!!!
   int get_origin_y();
   void rotateSurface(SDL_Surface* sur, int degrees, SDL_Surface* temp[]);
   void seperateTileset(SDL_Surface* sur, int frames, int tilewidth, int tileheight, SDL_Surface *temp[]);
   // These calls must surround all drawing routines.
   void beginScene();
   void endScene();
   //on the fly functions:
   void addShadow(SDL_Surface* shadow, int x, int y);
   void drawSprite(SDL_Surface* imageSurface, int dstX, int dstY);
   void drawLine(int srcX, int srcY, int dstX, int dstY, int r, int g, int b,int a);
    void drawRect(int x1, int y1, int x2, int y2, int r, int g, int b, int a);
   void drawText(const char* string,
                           int size,
                           int x, int y,
                           int fR, int fG, int fB,
                           int bR, int bG, int bB);
   void setBackgroundColor(int r, int g, int b);

   //Data:
private:
   
   int m_backgroundColorRed;
   int m_backgroundColorGreen;
   int m_backgroundColorBlue;
   TTF_Font* font;
   SDL_Surface* textSurface;

};

#endif // SDLGRAPHICS_H
